package inabit.inabitcompiler.productions.rule.expressions.arithmetic.method;

import inabit.compiler.parser.grammar.NonTerminal;
import inabit.compiler.parser.grammar.Production;
import inabit.compiler.parser.grammar.Symbol;
import inabit.compiler.parser.grammar.Terminal;
import inabit.inabitcompiler.lexical.InabitTokenClass;
import inabit.inabitcompiler.parser.InabitSemanticAction;

/**J -> (U)*/
/**@author Rafael Rocha*/
public class J_Rule extends Production{
	private NonTerminal U;
	public J_Rule() {
		super("J");
	}
	
	public Symbol[] production(final NonTerminal nonTerminal) {
		U = new NonTerminal("U");
		Symbol[] symbols = {
			new Terminal(InabitTokenClass.OPEN_PARENTHESIS),
			U,
			new Terminal(InabitTokenClass.CLOSE_PARENTHESIS),
			new InabitSemanticAction(nonTerminal) {
				public void execute() {
					nonTerminal.code = U.code;
				}
			}
		};
		return symbols;
	}
}
